package CarRental;

//客车类
public class Coach extends Automobile {
    private int seat;

    public Coach() {
    }

    public Coach(String licensePlate, String brand, double dailyRent, int seat) {
        super(licensePlate, brand, dailyRent);
        this.seat = seat;
    }
    public void showCar() {
        System.out.println("客车  车牌：" + this.getLicensePlate()+ ",品牌" + this.getBrand() + " "+this.seat+",日租金"
                +this.getDailyRent() + ",实时状态：" + (this.isState()? "可租" : "已租出"));
    }
    public String toString() {
        return "客车  车牌：" + Coach.this.getLicensePlate() +
                "，品牌" +  Coach.this.getBrand()+"\t座位数"+this.seat+
                "，日租金" +  Coach.this.getDailyRent()+
                ",状态："+( Coach.this.isState()?"可租":"已租出");
    }

    public int getSeat() {
        return seat;
    }

    public void setSeat(int seat) {
        this.seat = seat;
    }
    public double calculate(int day) {//计算租金
        double rental=getDailyRent()*day;
        if (day > 150)
            rental *= 0.6;
        else if (day > 30)
            rental *= 0.7;
        else if (day > 7)
            rental *= 0.8;
        else if (day > 3)
            rental *= 0.9;
        return rental;
    }
}
